<#import "../../common/layout.ftl" as l>


<@l.content>

<script>
    var crud = {
        read: "/manage/message/detail",
        update: '/manage/message/update',
        del: "/manage/message/delete"
    };

    var model = [
        {name : 'id',type : 'hidden',text : '编号',allowBlank : true,primaryKey : true},
        {name : 'msgid',type : 'hidden',text : 'msgid',allowBlank : false,primaryKey : false},
        {name : 'title',type : 'text',text : '标题',allowBlank : false,primaryKey : false},
        {name : 'msgcontent',type : 'editor',text : '消息内容',allowBlank : false,primaryKey : false},
        {name : 'msgstate',type : 'select',text : '状态',allowBlank : false,primaryKey : false,optionList:[
            {
                displayField : "草稿",
                valueField : '0'
            },{
                displayField : "发送",
                valueField : '1'
            }
        ]},
        {name : 'shipid',type : 'select',text : '船舶',allowBlank : false,primaryKey : false,options : {
            url : "/manage/ship/ajax/list",
            displayField : "shipName",
            valueField : "shipid"
        }}
    ];
</script>


<form id="pagination-form" method="post">

    <input type="hidden" name="page" value="${pageInfo.pageNum}">
    <input type="hidden" name="limit" value="${pageInfo.pageSize}">
    <input type="hidden" name="totalPage" value="${pageInfo.pages}">
    <div class="ibox">
        <div class="ibox-title">
            <h3><#if Session['currentMenu']??>${Session['currentMenu'].name}<#else></#if></h3>

            <div class="ibox-tools">
                <a id="pagination-delete" href="#">
                    <i class="fa fa-trash"></i>
                    删除
                </a>

            </div>
        </div>
        <div class="ibox-content">
            <div class="input-group search-content">
                <input type="text" name="key" value="<#if key??>${key}<#else></#if>" class="form-control" placeholder="请输入船名或者标题"> <span class="input-group-btn">
                <input type="submit" class="btn btn-primary" value="搜索">
            </span></div>
            <div>
                <div class="table-responsive">
                    <table class="table table-striped table-hover dataTables-example" >
                        <thead>
                        <tr>
                            <th>&nbsp;</th>
                            <th>船名</th>
                            <th>标题</th>
                            <th>内容</th>
                            <th>发送时间</th>
                            <th>发送人</th>
                            <th>消息状态</th>
                        </tr>
                        </thead>

                        <tbody>
                            <#list pageInfo.list as report>
                            <tr>
                                <td><input type="checkbox" class="i-checks" value="<#if report.id??>${report.id}<#else></#if>"></td>
                                <td><#if report.shipInfo??><#if report.shipInfo.shipName??>${report.shipInfo.shipName}<#else></#if><#else></#if></td>
                                <td><#if report.title??>${report.title}<#else></#if></td>
                                <td><#if report.msgcontent??>${report.msgcontent}<#else></#if></td>
                                <td><#if report.sendtime??>${report.sendtime}<#else></#if></td>
                                <td><#if report.msgauthor??>${report.msgauthor}<#else></#if></td>
                                <td><#if report.msgstate??><#if report.msgstate == '0'>草稿<#else>发送</#if><#else></#if></td>
                            </tr>
                            </#list>
                        </tbody>


                    </table>
                </div>
                <div class="pagination-content">
                    <div id="pagination" class="pagination">
                    </div>
                </div>
            </div>
        </div>

    </div>
</form>


</@l.content>

<script src="/pagination/js/pagination.js"></script>